<?php
namespace app\common\model;
class Config extends Base
{
    protected function initialize()
    {
        parent::initialize();
    }

    public static function saveConfig($data) {
        foreach($data as $k=>$v) {
            $where = [
                'name' => $k
            ];
            $old = self::getOne($where);
            if($old) {
                self::where($where)->update([
                    'value' => $v
                ]);
            }
        }
    }

    public static function getConfig () {
        return self::column('name,value');
    }
}